package com.example.Sao.Adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.Sao.MyBean.InfoBean;
import com.example.Sao.MyBean.Lbean;
import com.example.Sao.ObjectBox.DeviceEntity;
import com.example.Sao.R;

import java.util.List;

/**
 * @ProjectName: scan
 * @Package: com.example.Sao.Adapter
 * @ClassName: ListAnimationAdpter
 * @Description: 一条一条动画加载item的适配器
 * @Author: 阿毛
 * @CreateDate: 2020/4/30 16:17
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/4/30 16:17
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class ListAnimationAdpter extends RecyclerView.Adapter<ListAnimationAdpter.mViewHolder>{
    private Context context;
    private DeviceEntity InfoBeanList;
    public  ListAnimationAdpter(Context context, DeviceEntity InfoBeanList){
        this.context = context;
        this.InfoBeanList = InfoBeanList;
    }

    @NonNull
    @Override
    public mViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(context).inflate(R.layout.adpter_list_animation,viewGroup,false);
        return new mViewHolder(view);
    }

    @Override
    public int getItemCount() {
        return 7;
    }

    @Override
    public void onBindViewHolder(@NonNull mViewHolder mViewHolder, int i) {
           switch (i){
               case 1:
                   mViewHolder.mess.setText("设备名称:"+InfoBeanList.getDeviceName());
               break;
               case 2:
                   mViewHolder.mess.setText("使用部门:"+InfoBeanList.getUseDepartment());
                   break;
               case 3:
                   mViewHolder.mess.setText("流水码:"+InfoBeanList.getDeviceStreamCode());
                   break;
               case 4:
                   mViewHolder.mess.setText("所在区域:"+InfoBeanList.getLocationPosition());
                   break;
               case 5:
                   mViewHolder.mess.setText("所在楼层:"+InfoBeanList.getLocationFloor());
                   break;
               case 6:
                   mViewHolder.mess.setText("所在房间:"+InfoBeanList.getLocationRoom());
                   break;
               case 7:
                   mViewHolder.mess.setText("货架号:"+InfoBeanList.getLocationIbm());
                   break;
                   default:
                       break;
           }
            mViewHolder.status.setImageDrawable(context.getResources().getDrawable(R.mipmap.greenright));
    }

    class mViewHolder extends RecyclerView.ViewHolder{
        private TextView mess;
        private ImageView status;
        public mViewHolder(View v){
            super(v);
            mess = v.findViewById(R.id.message);
            status = v.findViewById(R.id.stutus);
        }
    }
}
